﻿using System;
using System.Collections.Generic;
using System.Text;
using Me.Prettyprint.Cassandra.Utils;
using Me.Prettyprint.Hector.Api.Ddl;

namespace Me.Prettyprint.Cassandra.Serializers
{
    /// <summary>
    /// ByteBufferSerializer is meant for internal uses only. Since .Net
    /// doesn't have an equivalent of ByteBuffer, we have our own and
    /// use this serializer to do some work.
    /// </summary>
    public class ByteBufferSerializer : AbstractSerializer<ByteBuffer>
    {
        public static ByteBufferSerializer Instance = new ByteBufferSerializer();
        public ByteBufferSerializer()
        {
        }
        public override byte[] ToBytes(ByteBuffer obj)
        {
            throw new NotImplementedException();
        }
        public override Me.Prettyprint.Cassandra.Utils.ByteBuffer ToByteBuffer(Me.Prettyprint.Cassandra.Utils.ByteBuffer obj)
        {
            if (obj == null)
            {
                return default(Me.Prettyprint.Cassandra.Utils.ByteBuffer);
            }
            return obj.Duplicate();
        }
        public override Me.Prettyprint.Cassandra.Utils.ByteBuffer FromByteBuffer(Utils.ByteBuffer buff)
        {
            if (buff == null)
            {
                return default(Me.Prettyprint.Cassandra.Utils.ByteBuffer);
            }
            return buff.Duplicate();
        }
        public override ByteBuffer FromBytes(byte[] bytes)
        {
            throw new NotImplementedException();
        }
        public new List<ByteBuffer> ToBytesList(List<ByteBuffer> list)
        {
            return list;
        }
        public List<ByteBuffer> FromBytesList(List<ByteBuffer> list)
        {
            return list;
        }
        public Dictionary<ByteBuffer, V> ToBytesMap<V>(Dictionary<ByteBuffer, V> map)
        {
            return map;
        }
        public Dictionary<ByteBuffer, V> FromBytesMap<V>(Dictionary<ByteBuffer, V> map)
        {
            return map;
        }
    }
}
